package font;

import java.awt.Font;
import java.awt.FontFormatException;
import java.io.File;
import java.io.IOException;

/**
 * 字体控制类
 * @author NHQ
 *
 */
public class FontCreater 
{
	private static Font defaultFont;
	private static Font rightFont;//对勾
	
	public static Font getDefalut()
	{
		if(defaultFont == null)
		{
			try {
				
				java.io.FileInputStream fi = new java.io.FileInputStream(new File("newFlightChess/src/font/default.TTF"));
				java.io.BufferedInputStream fb = new java.io.BufferedInputStream(fi);
				defaultFont = Font.createFont(Font.TRUETYPE_FONT, fb);
				defaultFont = defaultFont.deriveFont(Font.BOLD, 30);
			} catch (FontFormatException | IOException e) {
				e.printStackTrace();
			}
		}
		return defaultFont;
	}
	
	public static Font getRightFont()
	{
		if(rightFont == null)
		{
			try {
				
				java.io.FileInputStream fi = new java.io.FileInputStream(new File("src/font/STXINGKA.TTF"));
				java.io.BufferedInputStream fb = new java.io.BufferedInputStream(fi);
				rightFont = Font.createFont(Font.TRUETYPE_FONT, fb);
				rightFont = rightFont.deriveFont(Font.BOLD, 30);
			} catch (FontFormatException | IOException e) {
				e.printStackTrace();
			}
		}
		return rightFont;
	}
	
	
}
